package com.zty.xiaomi.server.Mapper;

import com.zty.xiaomi.server.Entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from userinfo where name=#{name}")
    User getUserInfoByName(String name);

    @Select("select userid,name,email,pwd,tel,status,date,privatekey,vote_status from userinfo where userid=#{userid}")
    User getUserInfoById(String userid);

    @Update("update userinfo set vote_statue = #{tribunal_id} where name = #{user_name}")
    int updateUserVoteStatus(String user_name, int tribunal_id);

    @Update("update userinfo set vote_statue = 0 where vote_statue = #{tribunal_id}")
    int updateUserVoteStatusByTribunalId(int tribunal_id);
}
